package co.fitstart.entity.market;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import co.fitstart.entity.principal.Principal;
import co.fitstart.entity.reference.Gender;
import co.fitstart.entity.site.Site;

/**
 * 线下体验课报名信息
 * @author haiyan_xiao
 *
 */
@Entity
@Table(name = "offline_experience_sign_up")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class OfflineExperienceSignUp {

    @Id
    @GeneratedValue
    private Long id;

    /** 姓名 */
    private String name;

    /** 手机 */
    private String mobile;

    /** 性别 */
    @Enumerated(EnumType.ORDINAL)
    private Gender gender;

    /** 身高 */
    private int height;

    /** 体重 */
    private BigDecimal weight;

    /** 是否有健身卡 */
    private boolean fit;

    /** 健身频率 */
    @Enumerated(EnumType.ORDINAL)
    private FitnessFrequency fitnessFrequency;

    /** 门店 */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
    @JsonIdentityReference(alwaysAsId=true)
    private Site site;

    /** 报名时间 */
    private Date createTime;

    /** 处理时间 */
    private Date handleTime;

    /** 备注 */
    private String remark;

    /** 处理人 */
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
    @JsonIdentityReference(alwaysAsId=true)
    private Principal handler;

    public OfflineExperienceSignUp() {
        
    }

    /**
     * 
     * @return
     */
    public OfflineExperienceSignUp initialize() {
        this.createTime = new Date();
        this.handleTime = null;
        this.remark = null;
        this.handler = null;
        return this;
    }

    /**
     * 
     * @param site
     * @return
     */
    public OfflineExperienceSignUp edit(Site site) {
        this.site = site;
        return this;
    }

    /**
     * 
     * @param remark
     * @param handler
     * @return
     */
    public OfflineExperienceSignUp handle(String remark, Principal handler) {
        this.handleTime = new Date();
        this.remark = remark;
        this.handler = handler;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the mobile
     */
    public String getMobile() {
        return mobile;
    }

    /**
     * @param mobile the mobile to set
     */
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    /**
     * @return the gender
     */
    public Gender getGender() {
        return gender;
    }

    /**
     * @param gender the gender to set
     */
    public void setGender(Gender gender) {
        this.gender = gender;
    }

    /**
     * @return the height
     */
    public int getHeight() {
        return height;
    }

    /**
     * @param height the height to set
     */
    public void setHeight(int height) {
        this.height = height;
    }

    /**
     * @return the weight
     */
    public BigDecimal getWeight() {
        return weight;
    }

    /**
     * @param weight the weight to set
     */
    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }

    /**
     * @return the fit
     */
    public boolean isFit() {
        return fit;
    }

    /**
     * @param fit the fit to set
     */
    public void setFit(boolean fit) {
        this.fit = fit;
    }

    /**
     * @return the fitnessFrequency
     */
    public FitnessFrequency getFitnessFrequency() {
        return fitnessFrequency;
    }

    /**
     * @param fitnessFrequency the fitnessFrequency to set
     */
    public void setFitnessFrequency(FitnessFrequency fitnessFrequency) {
        this.fitnessFrequency = fitnessFrequency;
    }

    /**
     * @return the site
     */
    public Site getSite() {
        return site;
    }

    /**
     * @param site the site to set
     */
    public void setSite(Site site) {
        this.site = site;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @return the handleTime
     */
    public Date getHandleTime() {
        return handleTime;
    }

    /**
     * @param handleTime the handleTime to set
     */
    public void setHandleTime(Date handleTime) {
        this.handleTime = handleTime;
    }

    /**
     * @return the remark
     */
    public String getRemark() {
        return remark;
    }

    /**
     * @param remark the remark to set
     */
    public void setRemark(String remark) {
        this.remark = remark;
    }

    /**
     * @return the handler
     */
    public Principal getHandler() {
        return handler;
    }

    /**
     * @param handler the handler to set
     */
    public void setHandler(Principal handler) {
        this.handler = handler;
    }
}
